<!--
* description: 数字输入框通用组件
* author: luojx
* createdDate: 2019-08-29
-->
<template>
  <el-col :span="span">
    <lableName :validrule="validrule" :cur-label-name="curLabelName" :is-show-label="isShowLabel" :is-require="isRequire" />
    <el-input-number
      v-model="modelCode"
      :placeholder="$t('sys.tips.esTip13')"
      :disabled="curDisabled"
      :min="dataToObject==null ?null:dataToObject.min"
      :is-type="dataToObject==null ?false :dataToObject.isType"
      :max="dataToObject==null ? null :dataToObject.max"
      :readonly="readonly"
      size="small"
      :suffix-icon="suffixIcon"
      :clearable="clearable"
      :type="inputType"
      :step="curStep"
      :precision="precision"
      @input="input"
      @clear="clearCode"
      @change="sendCode"
    />
    <validateFormate :cur-label-name="curLabelName" :validrule="validrule" />
  </el-col>
</template>
<script>
import { numberInputMixins } from '@/components/se/mixins/numInputMixins'
// import lableName from "@/components/lableName";
// import validateFormate from "@/components/validateFormate";
export default {
  components: {
    lableName: () => import('@/components/lableName'), // 标题溢出样式组件
    validateFormate: () => import('@/components/validateFormate') // 校验提示样式组件
  },
  mixins: [numberInputMixins],

  props: {
    placeholder: {
      type: String,
      default: '请输入'
    },
    isInteger: {
      type: Boolean,
      default: false
    }
  },

  methods: {
    input(code) {
      if (this.isInteger) {
        this.modelCode = this.modelCode.replace(/[^\.\d]/g, '')
        this.modelCode = this.modelCode.replace('.', '')
      }
      if (this.isNumInput) {
        this.$emit('numInput', code, this.codeField)
      }
    }
  }
}
</script>
